// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
/* eslint-disable */
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import ECharts from 'vue-echarts/components/ECharts'
import 'echarts/lib/chart/line'
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/pie'
import 'echarts/lib/component/polar'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/graphic'
import 'echarts/lib/component/title'
import animated from 'animate.css'
// scss工具类
import 'scssTool/index.scss'
import 'babel-polyfill'
import { MessageBox } from 'element-ui'
import 'jquery'

Vue.component('chart', ECharts)
Vue.use(ElementUI)
Vue.use(animated)

Vue.config.productionTip = false

// 判断是否IE10
router.beforeEach((to, from, next) => {
  // 判断IE
  var userAgent = navigator.userAgent
  // 判断是否IE浏览器
  var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1
  console.log(isIE)
  if (isIE) {
    var reIE = new RegExp('MSIE (\\d+\\.\\d+);')
    reIE.test(userAgent)
    var fIEVersion = parseFloat(RegExp['$1'])
    if (fIEVersion < 10) {
      MessageBox ({
        visible: true,
        title: '您的浏览器不支持',
        dangerouslyUseHTMLString: true,
        closeOnClickModal: false,
        closeOnPressEscape: false,
        showClose: false,
        showConfirmButton: false,
        message: `<div>请使用 <a style="color: #4063FF" href="https://www.google.cn/chrome/">Chrome浏览器</a> 或 <a style="color: #4063FF" href="https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads">IE10</a> 以上版本，以获取最佳体验。</div>`
      })
    } else {
      next()
    }
  } else {
    next()
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
